GskTextNode *self;
PangoRectangle ink_rect;
+ pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
+ pango_extents_to_pixels (&ink_rect, NULL);
+
+ /* Don't create nodes with empty bounds */
+ if (ink_rect.width == 0 || ink_rect.height == 0)
+ return NULL;
+
self = (GskTextNode *) gsk_render_node_new (&GSK_TEXT_NODE_CLASS, 0);
self->font = g_object_ref (font);
self->has_color = font_has_color_glyphs (font);
- pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
- pango_extents_to_pixels (&ink_rect, NULL);
graphene_rect_init (&self->render_node.bounds,
x_offset + base_x + ink_rect.x,
GdkRGBA color;
PangoRectangle ink_rect;
- /* FIXME: vulkan fallbacks don't deal with empty nodes gracefully */
- pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
- pango_extents_to_pixels (&ink_rect, NULL);
- if (ink_rect.width == 0 || ink_rect.height == 0)
- return;
-
gtk_snapshot_get_offset (crenderer->snapshot, &x_offset, &y_offset);
-
- gtk_snapshot_offset (crenderer->snapshot, base_x, base_y);
-
get_color (crenderer, PANGO_RENDER_PART_FOREGROUND, &color);
node = gsk_text_node_new (font, glyphs, &color, x_offset, y_offset, base_x, base_y);
+ if (node == NULL)
+ return;
+
if (crenderer->snapshot->record_names)
{
char name[64];
snprintf (name, sizeof (name), "Glyphs<%d>", glyphs->num_glyphs);
gsk_render_node_set_name (node, name);
}
+
+ gtk_snapshot_offset (crenderer->snapshot, base_x, base_y);
+
gtk_snapshot_append_node (crenderer->snapshot, node);
gsk_render_node_unref (node);